YES(O(1),O(n^2)) We are left with following problem, upon which TcT provides the certificate YES(O(1),O(n^2)). Strict Trs: { #less(@x, @y) -> #cklt(#compare(@x, @y)) , append(@l1, @l2) -> append#1(@l1, @l2) , append#1(::(@x, @xs), @l2) -> ::(@x, append(@xs, @l2)) , append#1(nil(), @l2) -> @l2 , flatten(@t) -> flatten#1(@t) , flatten#1(leaf()) -> nil() , flatten#1(node(@l, @t1, @t2)) -> append(@l, append(flatten(@t1), flatten(@t2))) , flattensort(@t) -> insertionsort(flatten(@t)) , insertionsort(@l) -> insertionsort#1(@l) , insert(@x, @l) -> insert#1(@l, @x) , insert#1(::(@y, @ys), @x) -> insert#2(#less(@y, @x), @x, @y, @ys) , insert#1(nil(), @x) -> ::(@x, nil()) , insert#2(#false(), @x, @y, @ys) -> ::(@x, ::(@y, @ys)) , insert#2(#true(), @x, @y, @ys) -> ::(@y, insert(@x, @ys)) , insertionsort#1(::(@x, @xs)) -> insert(@x, insertionsort(@xs)) , insertionsort#1(nil()) -> nil() } Weak Trs: { #compare(#0(), #0()) -> #EQ() , #compare(#0(), #neg(@y)) -> #GT() , #compare(#0(), #pos(@y)) -> #LT() , #compare(#0(), #s(@y)) -> #LT() , #compare(#neg(@x), #0()) -> #LT() , #compare(#neg(@x), #neg(@y)) -> #compare(@y, @x) , #compare(#neg(@x), #pos(@y)) -> #LT() , #compare(#pos(@x), #0()) -> #GT() , #compare(#pos(@x), #neg(@y)) -> #GT() , #compare(#pos(@x), #pos(@y)) -> #compare(@x, @y) , #compare(#s(@x), #0()) -> #GT() , #compare(#s(@x), #s(@y)) -> #compare(@x, @y) , #cklt(#EQ()) -> #false() , #cklt(#GT()) -> #false() , #cklt(#LT()) -> #true() } Obligation: innermost runtime complexity Answer: YES(O(1),O(n^2)) We add following dependency tuples: Strict DPs: { #less^#(@x, @y) -> c_1(#cklt^#(#compare(@x, @y)), #compare^#(@x, @y)) , append^#(@l1, @l2) -> c_2(append#1^#(@l1, @l2)) , append#1^#(::(@x, @xs), @l2) -> c_3(append^#(@xs, @l2)) , append#1^#(nil(), @l2) -> c_4() , flatten^#(@t) -> c_5(flatten#1^#(@t)) , flatten#1^#(leaf()) -> c_6() , flatten#1^#(node(@l, @t1, @t2)) -> c_7(append^#(@l, append(flatten(@t1), flatten(@t2))), append^#(flatten(@t1), flatten(@t2)), flatten^#(@t1), flatten^#(@t2)) , flattensort^#(@t) -> c_8(insertionsort^#(flatten(@t)), flatten^#(@t)) , insertionsort^#(@l) -> c_9(insertionsort#1^#(@l)) , insertionsort#1^#(::(@x, @xs)) -> c_15(insert^#(@x, insertionsort(@xs)), insertionsort^#(@xs)) , insertionsort#1^#(nil()) -> c_16() , insert^#(@x, @l) -> c_10(insert#1^#(@l, @x)) , insert#1^#(::(@y, @ys), @x) -> c_11(insert#2^#(#less(@y, @x), @x, @y, @ys), #less^#(@y, @x)) , insert#1^#(nil(), @x) -> c_12() , insert#2^#(#false(), @x, @y, @ys) -> c_13() , insert#2^#(#true(), @x, @y, @ys) -> c_14(insert^#(@x, @ys)) } Weak DPs: { #cklt^#(#EQ()) -> c_29() , #cklt^#(#GT()) -> c_30() , #cklt^#(#LT()) -> c_31() , #compare^#(#0(), #0()) -> c_17() , #compare^#(#0(), #neg(@y)) -> c_18() , #compare^#(#0(), #pos(@y)) -> c_19() , #compare^#(#0(), #s(@y)) -> c_20() , #compare^#(#neg(@x), #0()) -> c_21() , #compare^#(#neg(@x), #neg(@y)) -> c_22(#compare^#(@y, @x)) , #compare^#(#neg(@x), #pos(@y)) -> c_23() , #compare^#(#pos(@x), #0()) -> c_24() , #compare^#(#pos(@x), #neg(@y)) -> c_25() , #compare^#(#pos(@x), #pos(@y)) -> c_26(#compare^#(@x, @y)) , #compare^#(#s(@x), #0()) -> c_27() , #compare^#(#s(@x), #s(@y)) -> c_28(#compare^#(@x, @y)) } and mark the set of starting terms. We are left with following problem, upon which TcT provides the certificate YES(O(1),O(n^2)). Strict DPs: { #less^#(@x, @y) -> c_1(#cklt^#(#compare(@x, @y)), #compare^#(@x, @y)) , append^#(@l1, @l2) -> c_2(append#1^#(@l1, @l2)) , append#1^#(::(@x, @xs), @l2) -> c_3(append^#(@xs, @l2)) , append#1^#(nil(), @l2) -> c_4() , flatten^#(@t) -> c_5(flatten#1^#(@t)) , flatten#1^#(leaf()) -> c_6() , flatten#1^#(node(@l, @t1, @t2)) -> c_7(append^#(@l, append(flatten(@t1), flatten(@t2))), append^#(flatten(@t1), flatten(@t2)), flatten^#(@t1), flatten^#(@t2)) , flattensort^#(@t) -> c_8(insertionsort^#(flatten(@t)), flatten^#(@t)) , insertionsort^#(@l) -> c_9(insertionsort#1^#(@l)) , insertionsort#1^#(::(@x, @xs)) -> c_15(insert^#(@x, insertionsort(@xs)), insertionsort^#(@xs)) , insertionsort#1^#(nil()) -> c_16() , insert^#(@x, @l) -> c_10(insert#1^#(@l, @x)) , insert#1^#(::(@y, @ys), @x) -> c_11(insert#2^#(#less(@y, @x), @x, @y, @ys), #less^#(@y, @x)) , insert#1^#(nil(), @x) -> c_12() , insert#2^#(#false(), @x, @y, @ys) -> c_13() , insert#2^#(#true(), @x, @y, @ys) -> c_14(insert^#(@x, @ys)) } Weak DPs: { #cklt^#(#EQ()) -> c_29() , #cklt^#(#GT()) -> c_30() , #cklt^#(#LT()) -> c_31() , #compare^#(#0(), #0()) -> c_17() , #compare^#(#0(), #neg(@y)) -> c_18() , #compare^#(#0(), #pos(@y)) -> c_19() , #compare^#(#0(), #s(@y)) -> c_20() , #compare^#(#neg(@x), #0()) -> c_21() , #compare^#(#neg(@x), #neg(@y)) -> c_22(#compare^#(@y, @x)) , #compare^#(#neg(@x), #pos(@y)) -> c_23() , #compare^#(#pos(@x), #0()) -> c_24() , #compare^#(#pos(@x), #neg(@y)) -> c_25() , #compare^#(#pos(@x), #pos(@y)) -> c_26(#compare^#(@x, @y)) , #compare^#(#s(@x), #0()) -> c_27() , #compare^#(#s(@x), #s(@y)) -> c_28(#compare^#(@x, @y)) } Weak Trs: { #less(@x, @y) -> #cklt(#compare(@x, @y)) , #compare(#0(), #0()) -> #EQ() , #compare(#0(), #neg(@y)) -> #GT() , #compare(#0(), #pos(@y)) -> #LT() , #compare(#0(), #s(@y)) -> #LT() , #compare(#neg(@x), #0()) -> #LT() , #compare(#neg(@x), #neg(@y)) -> #compare(@y, @x) , #compare(#neg(@x), #pos(@y)) -> #LT() , #compare(#pos(@x), #0()) -> #GT() , #compare(#pos(@x), #neg(@y)) -> #GT() , #compare(#pos(@x), #pos(@y)) -> #compare(@x, @y) , #compare(#s(@x), #0()) -> #GT() , #compare(#s(@x), #s(@y)) -> #compare(@x, @y) , #cklt(#EQ()) -> #false() , #cklt(#GT()) -> #false() , #cklt(#LT()) -> #true() , append(@l1, @l2) -> append#1(@l1, @l2) , append#1(::(@x, @xs), @l2) -> ::(@x, append(@xs, @l2)) , append#1(nil(), @l2) -> @l2 , flatten(@t) -> flatten#1(@t) , flatten#1(leaf()) -> nil() , flatten#1(node(@l, @t1, @t2)) -> append(@l, append(flatten(@t1), flatten(@t2))) , flattensort(@t) -> insertionsort(flatten(@t)) , insertionsort(@l) -> insertionsort#1(@l) , insert(@x, @l) -> insert#1(@l, @x) , insert#1(::(@y, @ys), @x) -> insert#2(#less(@y, @x), @x, @y, @ys) , insert#1(nil(), @x) -> ::(@x, nil()) , insert#2(#false(), @x, @y, @ys) -> ::(@x, ::(@y, @ys)) , insert#2(#true(), @x, @y, @ys) -> ::(@y, insert(@x, @ys)) , insertionsort#1(::(@x, @xs)) -> insert(@x, insertionsort(@xs)) , insertionsort#1(nil()) -> nil() } Obligation: innermost runtime complexity Answer: YES(O(1),O(n^2)) We estimate the number of application of {1,4,6,11,14,15} by applications of Pre({1,4,6,11,14,15}) = {2,5,9,12,13}. Here rules are labeled as follows: DPs: { 1: #less^#(@x, @y) -> c_1(#cklt^#(#compare(@x, @y)), #compare^#(@x, @y)) , 2: append^#(@l1, @l2) -> c_2(append#1^#(@l1, @l2)) , 3: append#1^#(::(@x, @xs), @l2) -> c_3(append^#(@xs, @l2)) , 4: append#1^#(nil(), @l2) -> c_4() , 5: flatten^#(@t) -> c_5(flatten#1^#(@t)) , 6: flatten#1^#(leaf()) -> c_6() , 7: flatten#1^#(node(@l, @t1, @t2)) -> c_7(append^#(@l, append(flatten(@t1), flatten(@t2))), append^#(flatten(@t1), flatten(@t2)), flatten^#(@t1), flatten^#(@t2)) , 8: flattensort^#(@t) -> c_8(insertionsort^#(flatten(@t)), flatten^#(@t)) , 9: insertionsort^#(@l) -> c_9(insertionsort#1^#(@l)) , 10: insertionsort#1^#(::(@x, @xs)) -> c_15(insert^#(@x, insertionsort(@xs)), insertionsort^#(@xs)) , 11: insertionsort#1^#(nil()) -> c_16() , 12: insert^#(@x, @l) -> c_10(insert#1^#(@l, @x)) , 13: insert#1^#(::(@y, @ys), @x) -> c_11(insert#2^#(#less(@y, @x), @x, @y, @ys), #less^#(@y, @x)) , 14: insert#1^#(nil(), @x) -> c_12() , 15: insert#2^#(#false(), @x, @y, @ys) -> c_13() , 16: insert#2^#(#true(), @x, @y, @ys) -> c_14(insert^#(@x, @ys)) , 17: #cklt^#(#EQ()) -> c_29() , 18: #cklt^#(#GT()) -> c_30() , 19: #cklt^#(#LT()) -> c_31() , 20: #compare^#(#0(), #0()) -> c_17() , 21: #compare^#(#0(), #neg(@y)) -> c_18() , 22: #compare^#(#0(), #pos(@y)) -> c_19() , 23: #compare^#(#0(), #s(@y)) -> c_20() , 24: #compare^#(#neg(@x), #0()) -> c_21() , 25: #compare^#(#neg(@x), #neg(@y)) -> c_22(#compare^#(@y, @x)) , 26: #compare^#(#neg(@x), #pos(@y)) -> c_23() , 27: #compare^#(#pos(@x), #0()) -> c_24() , 28: #compare^#(#pos(@x), #neg(@y)) -> c_25() , 29: #compare^#(#pos(@x), #pos(@y)) -> c_26(#compare^#(@x, @y)) , 30: #compare^#(#s(@x), #0()) -> c_27() , 31: #compare^#(#s(@x), #s(@y)) -> c_28(#compare^#(@x, @y)) } We are left with following problem, upon which TcT provides the certificate YES(O(1),O(n^2)). Strict DPs: { append^#(@l1, @l2) -> c_2(append#1^#(@l1, @l2)) , append#1^#(::(@x, @xs), @l2) -> c_3(append^#(@xs, @l2)) , flatten^#(@t) -> c_5(flatten#1^#(@t)) , flatten#1^#(node(@l, @t1, @t2)) -> c_7(append^#(@l, append(flatten(@t1), flatten(@t2))), append^#(flatten(@t1), flatten(@t2)), flatten^#(@t1), flatten^#(@t2)) , flattensort^#(@t) -> c_8(insertionsort^#(flatten(@t)), flatten^#(@t)) , insertionsort^#(@l) -> c_9(insertionsort#1^#(@l)) , insertionsort#1^#(::(@x, @xs)) -> c_15(insert^#(@x, insertionsort(@xs)), insertionsort^#(@xs)) , insert^#(@x, @l) -> c_10(insert#1^#(@l, @x)) , insert#1^#(::(@y, @ys), @x) -> c_11(insert#2^#(#less(@y, @x), @x, @y, @ys), #less^#(@y, @x)) , insert#2^#(#true(), @x, @y, @ys) -> c_14(insert^#(@x, @ys)) } Weak DPs: { #less^#(@x, @y) -> c_1(#cklt^#(#compare(@x, @y)), #compare^#(@x, @y)) , #cklt^#(#EQ()) -> c_29() , #cklt^#(#GT()) -> c_30() , #cklt^#(#LT()) -> c_31() , #compare^#(#0(), #0()) -> c_17() , #compare^#(#0(), #neg(@y)) -> c_18() , #compare^#(#0(), #pos(@y)) -> c_19() , #compare^#(#0(), #s(@y)) -> c_20() , #compare^#(#neg(@x), #0()) -> c_21() , #compare^#(#neg(@x), #neg(@y)) -> c_22(#compare^#(@y, @x)) , #compare^#(#neg(@x), #pos(@y)) -> c_23() , #compare^#(#pos(@x), #0()) -> c_24() , #compare^#(#pos(@x), #neg(@y)) -> c_25() , #compare^#(#pos(@x), #pos(@y)) -> c_26(#compare^#(@x, @y)) , #compare^#(#s(@x), #0()) -> c_27() , #compare^#(#s(@x), #s(@y)) -> c_28(#compare^#(@x, @y)) , append#1^#(nil(), @l2) -> c_4() , flatten#1^#(leaf()) -> c_6() , insertionsort#1^#(nil()) -> c_16() , insert#1^#(nil(), @x) -> c_12() , insert#2^#(#false(), @x, @y, @ys) -> c_13() } Weak Trs: { #less(@x, @y) -> #cklt(#compare(@x, @y)) , #compare(#0(), #0()) -> #EQ() , #compare(#0(), #neg(@y)) -> #GT() , #compare(#0(), #pos(@y)) -> #LT() , #compare(#0(), #s(@y)) -> #LT() , #compare(#neg(@x), #0()) -> #LT() , #compare(#neg(@x), #neg(@y)) -> #compare(@y, @x) , #compare(#neg(@x), #pos(@y)) -> #LT() , #compare(#pos(@x), #0()) -> #GT() , #compare(#pos(@x), #neg(@y)) -> #GT() , #compare(#pos(@x), #pos(@y)) -> #compare(@x, @y) , #compare(#s(@x), #0()) -> #GT() , #compare(#s(@x), #s(@y)) -> #compare(@x, @y) , #cklt(#EQ()) -> #false() , #cklt(#GT()) -> #false() , #cklt(#LT()) -> #true() , append(@l1, @l2) -> append#1(@l1, @l2) , append#1(::(@x, @xs), @l2) -> ::(@x, append(@xs, @l2)) , append#1(nil(), @l2) -> @l2 , flatten(@t) -> flatten#1(@t) , flatten#1(leaf()) -> nil() , flatten#1(node(@l, @t1, @t2)) -> append(@l, append(flatten(@t1), flatten(@t2))) , flattensort(@t) -> insertionsort(flatten(@t)) , insertionsort(@l) -> insertionsort#1(@l) , insert(@x, @l) -> insert#1(@l, @x) , insert#1(::(@y, @ys), @x) -> insert#2(#less(@y, @x), @x, @y, @ys) , insert#1(nil(), @x) -> ::(@x, nil()) , insert#2(#false(), @x, @y, @ys) -> ::(@x, ::(@y, @ys)) , insert#2(#true(), @x, @y, @ys) -> ::(@y, insert(@x, @ys)) , insertionsort#1(::(@x, @xs)) -> insert(@x, insertionsort(@xs)) , insertionsort#1(nil()) -> nil() } Obligation: innermost runtime complexity Answer: YES(O(1),O(n^2)) The following weak DPs constitute a sub-graph of the DG that is closed under successors. The DPs are removed. { #less^#(@x, @y) -> c_1(#cklt^#(#compare(@x, @y)), #compare^#(@x, @y)) , #cklt^#(#EQ()) -> c_29() , #cklt^#(#GT()) -> c_30() , #cklt^#(#LT()) -> c_31() , #compare^#(#0(), #0()) -> c_17() , #compare^#(#0(), #neg(@y)) -> c_18() , #compare^#(#0(), #pos(@y)) -> c_19() , #compare^#(#0(), #s(@y)) -> c_20() , #compare^#(#neg(@x), #0()) -> c_21() , #compare^#(#neg(@x), #neg(@y)) -> c_22(#compare^#(@y, @x)) , #compare^#(#neg(@x), #pos(@y)) -> c_23() , #compare^#(#pos(@x), #0()) -> c_24() , #compare^#(#pos(@x), #neg(@y)) -> c_25() , #compare^#(#pos(@x), #pos(@y)) -> c_26(#compare^#(@x, @y)) , #compare^#(#s(@x), #0()) -> c_27() , #compare^#(#s(@x), #s(@y)) -> c_28(#compare^#(@x, @y)) , append#1^#(nil(), @l2) -> c_4() , flatten#1^#(leaf()) -> c_6() , insertionsort#1^#(nil()) -> c_16() , insert#1^#(nil(), @x) -> c_12() , insert#2^#(#false(), @x, @y, @ys) -> c_13() } We are left with following problem, upon which TcT provides the certificate YES(O(1),O(n^2)). Strict DPs: { append^#(@l1, @l2) -> c_2(append#1^#(@l1, @l2)) , append#1^#(::(@x, @xs), @l2) -> c_3(append^#(@xs, @l2)) , flatten^#(@t) -> c_5(flatten#1^#(@t)) , flatten#1^#(node(@l, @t1, @t2)) -> c_7(append^#(@l, append(flatten(@t1), flatten(@t2))), append^#(flatten(@t1), flatten(@t2)), flatten^#(@t1), flatten^#(@t2)) , flattensort^#(@t) -> c_8(insertionsort^#(flatten(@t)), flatten^#(@t)) , insertionsort^#(@l) -> c_9(insertionsort#1^#(@l)) , insertionsort#1^#(::(@x, @xs)) -> c_15(insert^#(@x, insertionsort(@xs)), insertionsort^#(@xs)) , insert^#(@x, @l) -> c_10(insert#1^#(@l, @x)) , insert#1^#(::(@y, @ys), @x) -> c_11(insert#2^#(#less(@y, @x), @x, @y, @ys), #less^#(@y, @x)) , insert#2^#(#true(), @x, @y, @ys) -> c_14(insert^#(@x, @ys)) } Weak Trs: { #less(@x, @y) -> #cklt(#compare(@x, @y)) , #compare(#0(), #0()) -> #EQ() , #compare(#0(), #neg(@y)) -> #GT() , #compare(#0(), #pos(@y)) -> #LT() , #compare(#0(), #s(@y)) -> #LT() , #compare(#neg(@x), #0()) -> #LT() , #compare(#neg(@x), #neg(@y)) -> #compare(@y, @x) , #compare(#neg(@x), #pos(@y)) -> #LT() , #compare(#pos(@x), #0()) -> #GT() , #compare(#pos(@x), #neg(@y)) -> #GT() , #compare(#pos(@x), #pos(@y)) -> #compare(@x, @y) , #compare(#s(@x), #0()) -> #GT() , #compare(#s(@x), #s(@y)) -> #compare(@x, @y) , #cklt(#EQ()) -> #false() , #cklt(#GT()) -> #false() , #cklt(#LT()) -> #true() , append(@l1, @l2) -> append#1(@l1, @l2) , append#1(::(@x, @xs), @l2) -> ::(@x, append(@xs, @l2)) , append#1(nil(), @l2) -> @l2 , flatten(@t) -> flatten#1(@t) , flatten#1(leaf()) -> nil() , flatten#1(node(@l, @t1, @t2)) -> append(@l, append(flatten(@t1), flatten(@t2))) , flattensort(@t) -> insertionsort(flatten(@t)) , insertionsort(@l) -> insertionsort#1(@l) , insert(@x, @l) -> insert#1(@l, @x) , insert#1(::(@y, @ys), @x) -> insert#2(#less(@y, @x), @x, @y, @ys) , insert#1(nil(), @x) -> ::(@x, nil()) , insert#2(#false(), @x, @y, @ys) -> ::(@x, ::(@y, @ys)) , insert#2(#true(), @x, @y, @ys) -> ::(@y, insert(@x, @ys)) , insertionsort#1(::(@x, @xs)) -> insert(@x, insertionsort(@xs)) , insertionsort#1(nil()) -> nil() } Obligation: innermost runtime complexity Answer: YES(O(1),O(n^2)) Due to missing edges in the dependency-graph, the right-hand sides of following rules could be simplified: { insert#1^#(::(@y, @ys), @x) -> c_11(insert#2^#(#less(@y, @x), @x, @y, @ys), #less^#(@y, @x)) } We are left with following problem, upon which TcT provides the certificate YES(O(1),O(n^2)). Strict DPs: { append^#(@l1, @l2) -> c_1(append#1^#(@l1, @l2)) , append#1^#(::(@x, @xs), @l2) -> c_2(append^#(@xs, @l2)) , flatten^#(@t) -> c_3(flatten#1^#(@t)) , flatten#1^#(node(@l, @t1, @t2)) -> c_4(append^#(@l, append(flatten(@t1), flatten(@t2))), append^#(flatten(@t1), flatten(@t2)), flatten^#(@t1), flatten^#(@t2)) , flattensort^#(@t) -> c_5(insertionsort^#(flatten(@t)), flatten^#(@t)) , insertionsort^#(@l) -> c_6(insertionsort#1^#(@l)) , insertionsort#1^#(::(@x, @xs)) -> c_7(insert^#(@x, insertionsort(@xs)), insertionsort^#(@xs)) , insert^#(@x, @l) -> c_8(insert#1^#(@l, @x)) , insert#1^#(::(@y, @ys), @x) -> c_9(insert#2^#(#less(@y, @x), @x, @y, @ys)) , insert#2^#(#true(), @x, @y, @ys) -> c_10(insert^#(@x, @ys)) } Weak Trs: { #less(@x, @y) -> #cklt(#compare(@x, @y)) , #compare(#0(), #0()) -> #EQ() , #compare(#0(), #neg(@y)) -> #GT() , #compare(#0(), #pos(@y)) -> #LT() , #compare(#0(), #s(@y)) -> #LT() , #compare(#neg(@x), #0()) -> #LT() , #compare(#neg(@x), #neg(@y)) -> #compare(@y, @x) , #compare(#neg(@x), #pos(@y)) -> #LT() , #compare(#pos(@x), #0()) -> #GT() , #compare(#pos(@x), #neg(@y)) -> #GT() , #compare(#pos(@x), #pos(@y)) -> #compare(@x, @y) , #compare(#s(@x), #0()) -> #GT() , #compare(#s(@x), #s(@y)) -> #compare(@x, @y) , #cklt(#EQ()) -> #false() , #cklt(#GT()) -> #false() , #cklt(#LT()) -> #true() , append(@l1, @l2) -> append#1(@l1, @l2) , append#1(::(@x, @xs), @l2) -> ::(@x, append(@xs, @l2)) , append#1(nil(), @l2) -> @l2 , flatten(@t) -> flatten#1(@t) , flatten#1(leaf()) -> nil() , flatten#1(node(@l, @t1, @t2)) -> append(@l, append(flatten(@t1), flatten(@t2))) , flattensort(@t) -> insertionsort(flatten(@t)) , insertionsort(@l) -> insertionsort#1(@l) , insert(@x, @l) -> insert#1(@l, @x) , insert#1(::(@y, @ys), @x) -> insert#2(#less(@y, @x), @x, @y, @ys) , insert#1(nil(), @x) -> ::(@x, nil()) , insert#2(#false(), @x, @y, @ys) -> ::(@x, ::(@y, @ys)) , insert#2(#true(), @x, @y, @ys) -> ::(@y, insert(@x, @ys)) , insertionsort#1(::(@x, @xs)) -> insert(@x, insertionsort(@xs)) , insertionsort#1(nil()) -> nil() } Obligation: innermost runtime complexity Answer: YES(O(1),O(n^2)) We replace rewrite rules by usable rules: Weak Usable Rules: { #less(@x, @y) -> #cklt(#compare(@x, @y)) , #compare(#0(), #0()) -> #EQ() , #compare(#0(), #neg(@y)) -> #GT() , #compare(#0(), #pos(@y)) -> #LT() , #compare(#0(), #s(@y)) -> #LT() , #compare(#neg(@x), #0()) -> #LT() , #compare(#neg(@x), #neg(@y)) -> #compare(@y, @x) , #compare(#neg(@x), #pos(@y)) -> #LT() , #compare(#pos(@x), #0()) -> #GT() , #compare(#pos(@x), #neg(@y)) -> #GT() , #compare(#pos(@x), #pos(@y)) -> #compare(@x, @y) , #compare(#s(@x), #0()) -> #GT() , #compare(#s(@x), #s(@y)) -> #compare(@x, @y) , #cklt(#EQ()) -> #false() , #cklt(#GT()) -> #false() , #cklt(#LT()) -> #true() , append(@l1, @l2) -> append#1(@l1, @l2) , append#1(::(@x, @xs), @l2) -> ::(@x, append(@xs, @l2)) , append#1(nil(), @l2) -> @l2 , flatten(@t) -> flatten#1(@t) , flatten#1(leaf()) -> nil() , flatten#1(node(@l, @t1, @t2)) -> append(@l, append(flatten(@t1), flatten(@t2))) , insertionsort(@l) -> insertionsort#1(@l) , insert(@x, @l) -> insert#1(@l, @x) , insert#1(::(@y, @ys), @x) -> insert#2(#less(@y, @x), @x, @y, @ys) , insert#1(nil(), @x) -> ::(@x, nil()) , insert#2(#false(), @x, @y, @ys) -> ::(@x, ::(@y, @ys)) , insert#2(#true(), @x, @y, @ys) -> ::(@y, insert(@x, @ys)) , insertionsort#1(::(@x, @xs)) -> insert(@x, insertionsort(@xs)) , insertionsort#1(nil()) -> nil() } We are left with following problem, upon which TcT provides the certificate YES(O(1),O(n^2)). Strict DPs: { append^#(@l1, @l2) -> c_1(append#1^#(@l1, @l2)) , append#1^#(::(@x, @xs), @l2) -> c_2(append^#(@xs, @l2)) , flatten^#(@t) -> c_3(flatten#1^#(@t)) , flatten#1^#(node(@l, @t1, @t2)) -> c_4(append^#(@l, append(flatten(@t1), flatten(@t2))), append^#(flatten(@t1), flatten(@t2)), flatten^#(@t1), flatten^#(@t2)) , flattensort^#(@t) -> c_5(insertionsort^#(flatten(@t)), flatten^#(@t)) , insertionsort^#(@l) -> c_6(insertionsort#1^#(@l)) , insertionsort#1^#(::(@x, @xs)) -> c_7(insert^#(@x, insertionsort(@xs)), insertionsort^#(@xs)) , insert^#(@x, @l) -> c_8(insert#1^#(@l, @x)) , insert#1^#(::(@y, @ys), @x) -> c_9(insert#2^#(#less(@y, @x), @x, @y, @ys)) , insert#2^#(#true(), @x, @y, @ys) -> c_10(insert^#(@x, @ys)) } Weak Trs: { #less(@x, @y) -> #cklt(#compare(@x, @y)) , #compare(#0(), #0()) -> #EQ() , #compare(#0(), #neg(@y)) -> #GT() , #compare(#0(), #pos(@y)) -> #LT() , #compare(#0(), #s(@y)) -> #LT() , #compare(#neg(@x), #0()) -> #LT() , #compare(#neg(@x), #neg(@y)) -> #compare(@y, @x) , #compare(#neg(@x), #pos(@y)) -> #LT() , #compare(#pos(@x), #0()) -> #GT() , #compare(#pos(@x), #neg(@y)) -> #GT() , #compare(#pos(@x), #pos(@y)) -> #compare(@x, @y) , #compare(#s(@x), #0()) -> #GT() , #compare(#s(@x), #s(@y)) -> #compare(@x, @y) , #cklt(#EQ()) -> #false() , #cklt(#GT()) -> #false() , #cklt(#LT()) -> #true() , append(@l1, @l2) -> append#1(@l1, @l2) , append#1(::(@x, @xs), @l2) -> ::(@x, append(@xs, @l2)) , append#1(nil(), @l2) -> @l2 , flatten(@t) -> flatten#1(@t) , flatten#1(leaf()) -> nil() , flatten#1(node(@l, @t1, @t2)) -> append(@l, append(flatten(@t1), flatten(@t2))) , insertionsort(@l) -> insertionsort#1(@l) , insert(@x, @l) -> insert#1(@l, @x) , insert#1(::(@y, @ys), @x) -> insert#2(#less(@y, @x), @x, @y, @ys) , insert#1(nil(), @x) -> ::(@x, nil()) , insert#2(#false(), @x, @y, @ys) -> ::(@x, ::(@y, @ys)) , insert#2(#true(), @x, @y, @ys) -> ::(@y, insert(@x, @ys)) , insertionsort#1(::(@x, @xs)) -> insert(@x, insertionsort(@xs)) , insertionsort#1(nil()) -> nil() } Obligation: innermost runtime complexity Answer: YES(O(1),O(n^2)) We use the processor 'matrix interpretation of dimension 2' to orient following rules strictly. DPs: { 2: append#1^#(::(@x, @xs), @l2) -> c_2(append^#(@xs, @l2)) } Sub-proof: ---------- The following argument positions are usable: Uargs(c_1) = {1}, Uargs(c_2) = {1}, Uargs(c_3) = {1}, Uargs(c_4) = {1, 2, 3, 4}, Uargs(c_5) = {1, 2}, Uargs(c_6) = {1}, Uargs(c_7) = {1, 2}, Uargs(c_8) = {1}, Uargs(c_9) = {1}, Uargs(c_10) = {1} TcT has computed following constructor-based matrix interpretation satisfying not(EDA). [#less](x1, x2) = [0] [0] [#compare](x1, x2) = [0 1] x1 + [0 0] x2 + [0] [1 0] [1 0] [0] [#cklt](x1) = [0] [0] [append](x1, x2) = [0 0] x1 + [1 0] x2 + [0] [0 1] [1 1] [0] [append#1](x1, x2) = [0 0] x1 + [1 0] x2 + [0] [0 1] [1 1] [0] [::](x1, x2) = [0 0] x1 + [1 0] x2 + [0] [0 1] [0 1] [1] [nil] = [0] [1] [flatten](x1) = [0 0] x1 + [0] [0 1] [1] [flatten#1](x1) = [0 0] x1 + [0] [0 1] [1] [leaf] = [0] [1] [node](x1, x2, x3) = [1 1] x1 + [1 1] x2 + [1 0] x3 + [1] [0 1] [0 1] [0 1] [1] [insertionsort](x1) = [1 0] x1 + [0] [1 0] [1] [insert](x1, x2) = [1 0] x2 + [0] [1 1] [0] [insert#1](x1, x2) = [0 0] x1 + [1 0] x2 + [0] [0 1] [1 1] [0] [insert#2](x1, x2, x3, x4) = [0 1] x1 + [1 1] x2 + [1 1] x3 + [1 0] x4 + [0] [0 1] [1 1] [1 1] [1 1] [0] [#false] = [0] [0] [#true] = [0] [0] [insertionsort#1](x1) = [0 0] x1 + [0] [1 0] [1] [#EQ] = [0] [1] [#GT] = [0] [1] [#LT] = [0] [1] [#0] = [0] [0] [#neg](x1) = [0 1] x1 + [1] [0 0] [0] [#pos](x1) = [1 0] x1 + [0] [0 1] [0] [#s](x1) = [1 0] x1 + [0] [0 1] [0] [#less^#](x1, x2) = [0] [0] [#cklt^#](x1) = [0] [0] [#compare^#](x1, x2) = [0] [0] [append^#](x1, x2) = [1 1] x1 + [0] [0 0] [0] [append#1^#](x1, x2) = [1 1] x1 + [0] [0 0] [1] [flatten^#](x1) = [1 0] x1 + [0] [1 0] [0] [flatten#1^#](x1) = [1 0] x1 + [0] [0 0] [0] [flattensort^#](x1) = [1 0] x1 + [1] [1 1] [1] [insertionsort^#](x1) = [0] [0] [insertionsort#1^#](x1) = [0] [0] [insert^#](x1, x2) = [0] [0] [insert#1^#](x1, x2) = [0] [0] [insert#2^#](x1, x2, x3, x4) = [1 1] x1 + [0] [0 0] [0] [c_1](x1) = [1 0] x1 + [0] [0 0] [0] [c_2](x1) = [1 0] x1 + [0] [0 0] [0] [c_3](x1) = [1 1] x1 + [0] [0 0] [0] [c_4](x1, x2, x3, x4) = [1 1] x1 + [1 1] x2 + [1 0] x3 + [1 0] x4 + [0] [0 0] [0 0] [0 0] [0 0] [0] [c_5](x1, x2) = [1 0] x1 + [1 0] x2 + [1] [0 0] [0 0] [1] [c_6](x1) = [1 1] x1 + [0] [0 0] [0] [c_7](x1, x2) = [1 1] x1 + [1 1] x2 + [0] [0 0] [0 0] [0] [c_8](x1) = [1 1] x1 + [0] [0 0] [0] [c_9](x1) = [1 1] x1 + [0] [0 0] [0] [c_10](x1) = [1 0] x1 + [0] [0 0] [0] This order satisfies following ordering constraints [#less(@x, @y)] = [0] [0] >= [0] [0] = [#cklt(#compare(@x, @y))] [#cklt(#EQ())] = [0] [0] >= [0] [0] = [#false()] [#cklt(#GT())] = [0] [0] >= [0] [0] = [#false()] [#cklt(#LT())] = [0] [0] >= [0] [0] = [#true()] [append(@l1, @l2)] = [0 0] @l1 + [1 0] @l2 + [0] [0 1] [1 1] [0] >= [0 0] @l1 + [1 0] @l2 + [0] [0 1] [1 1] [0] = [append#1(@l1, @l2)] [append#1(::(@x, @xs), @l2)] = [1 0] @l2 + [0 0] @x + [0 0] @xs + [0] [1 1] [0 1] [0 1] [1] >= [1 0] @l2 + [0 0] @x + [0 0] @xs + [0] [1 1] [0 1] [0 1] [1] = [::(@x, append(@xs, @l2))] [append#1(nil(), @l2)] = [1 0] @l2 + [0] [1 1] [1] >= [1 0] @l2 + [0] [0 1] [0] = [@l2] [flatten(@t)] = [0 0] @t + [0] [0 1] [1] >= [0 0] @t + [0] [0 1] [1] = [flatten#1(@t)] [flatten#1(leaf())] = [0] [2] >= [0] [1] = [nil()] [flatten#1(node(@l, @t1, @t2))] = [0 0] @l + [0 0] @t1 + [0 0] @t2 + [0] [0 1] [0 1] [0 1] [2] >= [0 0] @l + [0 0] @t1 + [0 0] @t2 + [0] [0 1] [0 1] [0 1] [2] = [append(@l, append(flatten(@t1), flatten(@t2)))] [append^#(@l1, @l2)] = [1 1] @l1 + [0] [0 0] [0] >= [1 1] @l1 + [0] [0 0] [0] = [c_1(append#1^#(@l1, @l2))] [append#1^#(::(@x, @xs), @l2)] = [0 1] @x + [1 1] @xs + [1] [0 0] [0 0] [1] > [1 1] @xs + [0] [0 0] [0] = [c_2(append^#(@xs, @l2))] [flatten^#(@t)] = [1 0] @t + [0] [1 0] [0] >= [1 0] @t + [0] [0 0] [0] = [c_3(flatten#1^#(@t))] [flatten#1^#(node(@l, @t1, @t2))] = [1 1] @l + [1 1] @t1 + [1 0] @t2 + [1] [0 0] [0 0] [0 0] [0] >= [1 1] @l + [1 1] @t1 + [1 0] @t2 + [1] [0 0] [0 0] [0 0] [0] = [c_4(append^#(@l, append(flatten(@t1), flatten(@t2))), append^#(flatten(@t1), flatten(@t2)), flatten^#(@t1), flatten^#(@t2))] [flattensort^#(@t)] = [1 0] @t + [1] [1 1] [1] >= [1 0] @t + [1] [0 0] [1] = [c_5(insertionsort^#(flatten(@t)), flatten^#(@t))] [insertionsort^#(@l)] = [0] [0] >= [0] [0] = [c_6(insertionsort#1^#(@l))] [insertionsort#1^#(::(@x, @xs))] = [0] [0] >= [0] [0] = [c_7(insert^#(@x, insertionsort(@xs)), insertionsort^#(@xs))] [insert^#(@x, @l)] = [0] [0] >= [0] [0] = [c_8(insert#1^#(@l, @x))] [insert#1^#(::(@y, @ys), @x)] = [0] [0] >= [0] [0] = [c_9(insert#2^#(#less(@y, @x), @x, @y, @ys))] [insert#2^#(#true(), @x, @y, @ys)] = [0] [0] >= [0] [0] = [c_10(insert^#(@x, @ys))] Consider the set of all dependency pairs DPs: { 1: append^#(@l1, @l2) -> c_1(append#1^#(@l1, @l2)) , 2: append#1^#(::(@x, @xs), @l2) -> c_2(append^#(@xs, @l2)) , 3: flatten^#(@t) -> c_3(flatten#1^#(@t)) , 4: flatten#1^#(node(@l, @t1, @t2)) -> c_4(append^#(@l, append(flatten(@t1), flatten(@t2))), append^#(flatten(@t1), flatten(@t2)), flatten^#(@t1), flatten^#(@t2)) , 5: flattensort^#(@t) -> c_5(insertionsort^#(flatten(@t)), flatten^#(@t)) , 6: insertionsort^#(@l) -> c_6(insertionsort#1^#(@l)) , 7: insertionsort#1^#(::(@x, @xs)) -> c_7(insert^#(@x, insertionsort(@xs)), insertionsort^#(@xs)) , 8: insert^#(@x, @l) -> c_8(insert#1^#(@l, @x)) , 9: insert#1^#(::(@y, @ys), @x) -> c_9(insert#2^#(#less(@y, @x), @x, @y, @ys)) , 10: insert#2^#(#true(), @x, @y, @ys) -> c_10(insert^#(@x, @ys)) } Processor 'matrix interpretation of dimension 2' induces the complexity certificate YES(?,O(n^2)) on application of dependency pairs {2}. These cover all (indirect) predecessors of dependency pairs {2,5}, their number of application is equally bounded. The dependency pairs are shifted into the corresponding weak component(s). We are left with following problem, upon which TcT provides the certificate YES(O(1),O(n^2)). Strict DPs: { append^#(@l1, @l2) -> c_1(append#1^#(@l1, @l2)) , flatten^#(@t) -> c_3(flatten#1^#(@t)) , flatten#1^#(node(@l, @t1, @t2)) -> c_4(append^#(@l, append(flatten(@t1), flatten(@t2))), append^#(flatten(@t1), flatten(@t2)), flatten^#(@t1), flatten^#(@t2)) , insertionsort^#(@l) -> c_6(insertionsort#1^#(@l)) , insertionsort#1^#(::(@x, @xs)) -> c_7(insert^#(@x, insertionsort(@xs)), insertionsort^#(@xs)) , insert^#(@x, @l) -> c_8(insert#1^#(@l, @x)) , insert#1^#(::(@y, @ys), @x) -> c_9(insert#2^#(#less(@y, @x), @x, @y, @ys)) , insert#2^#(#true(), @x, @y, @ys) -> c_10(insert^#(@x, @ys)) } Weak DPs: { append#1^#(::(@x, @xs), @l2) -> c_2(append^#(@xs, @l2)) , flattensort^#(@t) -> c_5(insertionsort^#(flatten(@t)), flatten^#(@t)) } Weak Trs: { #less(@x, @y) -> #cklt(#compare(@x, @y)) , #compare(#0(), #0()) -> #EQ() , #compare(#0(), #neg(@y)) -> #GT() , #compare(#0(), #pos(@y)) -> #LT() , #compare(#0(), #s(@y)) -> #LT() , #compare(#neg(@x), #0()) -> #LT() , #compare(#neg(@x), #neg(@y)) -> #compare(@y, @x) , #compare(#neg(@x), #pos(@y)) -> #LT() , #compare(#pos(@x), #0()) -> #GT() , #compare(#pos(@x), #neg(@y)) -> #GT() , #compare(#pos(@x), #pos(@y)) -> #compare(@x, @y) , #compare(#s(@x), #0()) -> #GT() , #compare(#s(@x), #s(@y)) -> #compare(@x, @y) , #cklt(#EQ()) -> #false() , #cklt(#GT()) -> #false() , #cklt(#LT()) -> #true() , append(@l1, @l2) -> append#1(@l1, @l2) , append#1(::(@x, @xs), @l2) -> ::(@x, append(@xs, @l2)) , append#1(nil(), @l2) -> @l2 , flatten(@t) -> flatten#1(@t) , flatten#1(leaf()) -> nil() , flatten#1(node(@l, @t1, @t2)) -> append(@l, append(flatten(@t1), flatten(@t2))) , insertionsort(@l) -> insertionsort#1(@l) , insert(@x, @l) -> insert#1(@l, @x) , insert#1(::(@y, @ys), @x) -> insert#2(#less(@y, @x), @x, @y, @ys) , insert#1(nil(), @x) -> ::(@x, nil()) , insert#2(#false(), @x, @y, @ys) -> ::(@x, ::(@y, @ys)) , insert#2(#true(), @x, @y, @ys) -> ::(@y, insert(@x, @ys)) , insertionsort#1(::(@x, @xs)) -> insert(@x, insertionsort(@xs)) , insertionsort#1(nil()) -> nil() } Obligation: innermost runtime complexity Answer: YES(O(1),O(n^2)) We use the processor 'matrix interpretation of dimension 2' to orient following rules strictly. DPs: { 3: flatten#1^#(node(@l, @t1, @t2)) -> c_4(append^#(@l, append(flatten(@t1), flatten(@t2))), append^#(flatten(@t1), flatten(@t2)), flatten^#(@t1), flatten^#(@t2)) , 9: append#1^#(::(@x, @xs), @l2) -> c_2(append^#(@xs, @l2)) } Trs: { append#1(::(@x, @xs), @l2) -> ::(@x, append(@xs, @l2)) , flatten#1(node(@l, @t1, @t2)) -> append(@l, append(flatten(@t1), flatten(@t2))) , insert#1(::(@y, @ys), @x) -> insert#2(#less(@y, @x), @x, @y, @ys) , insertionsort#1(::(@x, @xs)) -> insert(@x, insertionsort(@xs)) } Sub-proof: ---------- The following argument positions are usable: Uargs(c_1) = {1}, Uargs(c_2) = {1}, Uargs(c_3) = {1}, Uargs(c_4) = {1, 2, 3, 4}, Uargs(c_5) = {1, 2}, Uargs(c_6) = {1}, Uargs(c_7) = {1, 2}, Uargs(c_8) = {1}, Uargs(c_9) = {1}, Uargs(c_10) = {1} TcT has computed following constructor-based matrix interpretation satisfying not(EDA). [#less](x1, x2) = [0] [0] [#compare](x1, x2) = [0 0] x1 + [1 0] x2 + [0] [1 0] [1 0] [0] [#cklt](x1) = [0] [0] [append](x1, x2) = [1 1] x1 + [1 0] x2 + [0] [0 1] [0 1] [0] [append#1](x1, x2) = [1 1] x1 + [1 0] x2 + [0] [0 1] [0 1] [0] [::](x1, x2) = [1 1] x1 + [1 0] x2 + [0] [0 0] [0 1] [1] [nil] = [0] [0] [flatten](x1) = [1 0] x1 + [0] [0 1] [0] [flatten#1](x1) = [1 0] x1 + [0] [0 1] [0] [leaf] = [0] [0] [node](x1, x2, x3) = [1 1] x1 + [1 1] x2 + [1 1] x3 + [1] [0 1] [0 1] [0 1] [0] [insertionsort](x1) = [1 0] x1 + [0] [0 0] [0] [insert](x1, x2) = [1 0] x1 + [1 0] x2 + [0] [0 0] [1 1] [0] [insert#1](x1, x2) = [1 1] x1 + [1 0] x2 + [0] [1 1] [1 1] [0] [insert#2](x1, x2, x3, x4) = [1 0] x2 + [1 0] x3 + [1 0] x4 + [0] [0 0] [0 0] [1 1] [0] [#false] = [0] [0] [#true] = [0] [0] [insertionsort#1](x1) = [1 1] x1 + [0] [1 0] [1] [#EQ] = [0] [0] [#GT] = [0] [0] [#LT] = [0] [0] [#0] = [0] [0] [#neg](x1) = [1 0] x1 + [0] [0 1] [0] [#pos](x1) = [0 1] x1 + [0] [0 0] [0] [#s](x1) = [0] [0] [#less^#](x1, x2) = [0] [0] [#cklt^#](x1) = [0] [0] [#compare^#](x1, x2) = [0] [0] [append^#](x1, x2) = [0 1] x1 + [0] [1 0] [0] [append#1^#](x1, x2) = [0 1] x1 + [0] [0 0] [0] [flatten^#](x1) = [1 0] x1 + [0] [0 0] [1] [flatten#1^#](x1) = [1 0] x1 + [0] [1 0] [0] [flattensort^#](x1) = [1 1] x1 + [1] [1 1] [1] [insertionsort^#](x1) = [0 1] x1 + [0] [0 1] [0] [insertionsort#1^#](x1) = [0 1] x1 + [0] [1 1] [0] [insert^#](x1, x2) = [1] [1] [insert#1^#](x1, x2) = [1] [0] [insert#2^#](x1, x2, x3, x4) = [1] [1] [c_1](x1) = [1 1] x1 + [0] [0 0] [0] [c_2](x1) = [1 0] x1 + [0] [0 0] [0] [c_3](x1) = [1 0] x1 + [0] [0 0] [0] [c_4](x1, x2, x3, x4) = [1 0] x1 + [1 0] x2 + [1 0] x3 + [1 0] x4 + [0] [0 0] [0 0] [0 0] [0 0] [0] [c_5](x1, x2) = [1 0] x1 + [1 0] x2 + [1] [0 0] [0 0] [1] [c_6](x1) = [1 0] x1 + [0] [0 0] [0] [c_7](x1, x2) = [1 0] x1 + [1 0] x2 + [0] [0 0] [0 0] [0] [c_8](x1) = [1 1] x1 + [0] [0 0] [0] [c_9](x1) = [1 0] x1 + [0] [0 0] [0] [c_10](x1) = [1 0] x1 + [0] [0 0] [1] This order satisfies following ordering constraints [append(@l1, @l2)] = [1 1] @l1 + [1 0] @l2 + [0] [0 1] [0 1] [0] >= [1 1] @l1 + [1 0] @l2 + [0] [0 1] [0 1] [0] = [append#1(@l1, @l2)] [append#1(::(@x, @xs), @l2)] = [1 0] @l2 + [1 1] @x + [1 1] @xs + [1] [0 1] [0 0] [0 1] [1] > [1 0] @l2 + [1 1] @x + [1 1] @xs + [0] [0 1] [0 0] [0 1] [1] = [::(@x, append(@xs, @l2))] [append#1(nil(), @l2)] = [1 0] @l2 + [0] [0 1] [0] >= [1 0] @l2 + [0] [0 1] [0] = [@l2] [flatten(@t)] = [1 0] @t + [0] [0 1] [0] >= [1 0] @t + [0] [0 1] [0] = [flatten#1(@t)] [flatten#1(leaf())] = [0] [0] >= [0] [0] = [nil()] [flatten#1(node(@l, @t1, @t2))] = [1 1] @l + [1 1] @t1 + [1 1] @t2 + [1] [0 1] [0 1] [0 1] [0] > [1 1] @l + [1 1] @t1 + [1 0] @t2 + [0] [0 1] [0 1] [0 1] [0] = [append(@l, append(flatten(@t1), flatten(@t2)))] [append^#(@l1, @l2)] = [0 1] @l1 + [0] [1 0] [0] >= [0 1] @l1 + [0] [0 0] [0] = [c_1(append#1^#(@l1, @l2))] [append#1^#(::(@x, @xs), @l2)] = [0 1] @xs + [1] [0 0] [0] > [0 1] @xs + [0] [0 0] [0] = [c_2(append^#(@xs, @l2))] [flatten^#(@t)] = [1 0] @t + [0] [0 0] [1] >= [1 0] @t + [0] [0 0] [0] = [c_3(flatten#1^#(@t))] [flatten#1^#(node(@l, @t1, @t2))] = [1 1] @l + [1 1] @t1 + [1 1] @t2 + [1] [1 1] [1 1] [1 1] [1] > [0 1] @l + [1 1] @t1 + [1 0] @t2 + [0] [0 0] [0 0] [0 0] [0] = [c_4(append^#(@l, append(flatten(@t1), flatten(@t2))), append^#(flatten(@t1), flatten(@t2)), flatten^#(@t1), flatten^#(@t2))] [flattensort^#(@t)] = [1 1] @t + [1] [1 1] [1] >= [1 1] @t + [1] [0 0] [1] = [c_5(insertionsort^#(flatten(@t)), flatten^#(@t))] [insertionsort^#(@l)] = [0 1] @l + [0] [0 1] [0] >= [0 1] @l + [0] [0 0] [0] = [c_6(insertionsort#1^#(@l))] [insertionsort#1^#(::(@x, @xs))] = [0 0] @x + [0 1] @xs + [1] [1 1] [1 1] [1] >= [0 1] @xs + [1] [0 0] [0] = [c_7(insert^#(@x, insertionsort(@xs)), insertionsort^#(@xs))] [insert^#(@x, @l)] = [1] [1] >= [1] [0] = [c_8(insert#1^#(@l, @x))] [insert#1^#(::(@y, @ys), @x)] = [1] [0] >= [1] [0] = [c_9(insert#2^#(#less(@y, @x), @x, @y, @ys))] [insert#2^#(#true(), @x, @y, @ys)] = [1] [1] >= [1] [1] = [c_10(insert^#(@x, @ys))] Consider the set of all dependency pairs DPs: { 1: append^#(@l1, @l2) -> c_1(append#1^#(@l1, @l2)) , 2: flatten^#(@t) -> c_3(flatten#1^#(@t)) , 3: flatten#1^#(node(@l, @t1, @t2)) -> c_4(append^#(@l, append(flatten(@t1), flatten(@t2))), append^#(flatten(@t1), flatten(@t2)), flatten^#(@t1), flatten^#(@t2)) , 4: insertionsort^#(@l) -> c_6(insertionsort#1^#(@l)) , 5: insertionsort#1^#(::(@x, @xs)) -> c_7(insert^#(@x, insertionsort(@xs)), insertionsort^#(@xs)) , 6: insert^#(@x, @l) -> c_8(insert#1^#(@l, @x)) , 7: insert#1^#(::(@y, @ys), @x) -> c_9(insert#2^#(#less(@y, @x), @x, @y, @ys)) , 8: insert#2^#(#true(), @x, @y, @ys) -> c_10(insert^#(@x, @ys)) , 9: append#1^#(::(@x, @xs), @l2) -> c_2(append^#(@xs, @l2)) , 10: flattensort^#(@t) -> c_5(insertionsort^#(flatten(@t)), flatten^#(@t)) } Processor 'matrix interpretation of dimension 2' induces the complexity certificate YES(?,O(n^2)) on application of dependency pairs {3,9}. These cover all (indirect) predecessors of dependency pairs {1,2,3,9,10}, their number of application is equally bounded. The dependency pairs are shifted into the corresponding weak component(s). We apply the transformation 'removetails' on the sub-problem: Strict DPs: { insertionsort^#(@l) -> c_6(insertionsort#1^#(@l)) , insertionsort#1^#(::(@x, @xs)) -> c_7(insert^#(@x, insertionsort(@xs)), insertionsort^#(@xs)) , insert^#(@x, @l) -> c_8(insert#1^#(@l, @x)) , insert#1^#(::(@y, @ys), @x) -> c_9(insert#2^#(#less(@y, @x), @x, @y, @ys)) , insert#2^#(#true(), @x, @y, @ys) -> c_10(insert^#(@x, @ys)) } Weak DPs: { append^#(@l1, @l2) -> c_1(append#1^#(@l1, @l2)) , append#1^#(::(@x, @xs), @l2) -> c_2(append^#(@xs, @l2)) , flatten^#(@t) -> c_3(flatten#1^#(@t)) , flatten#1^#(node(@l, @t1, @t2)) -> c_4(append^#(@l, append(flatten(@t1), flatten(@t2))), append^#(flatten(@t1), flatten(@t2)), flatten^#(@t1), flatten^#(@t2)) , flattensort^#(@t) -> c_5(insertionsort^#(flatten(@t)), flatten^#(@t)) } Weak Trs: { #less(@x, @y) -> #cklt(#compare(@x, @y)) , #compare(#0(), #0()) -> #EQ() , #compare(#0(), #neg(@y)) -> #GT() , #compare(#0(), #pos(@y)) -> #LT() , #compare(#0(), #s(@y)) -> #LT() , #compare(#neg(@x), #0()) -> #LT() , #compare(#neg(@x), #neg(@y)) -> #compare(@y, @x) , #compare(#neg(@x), #pos(@y)) -> #LT() , #compare(#pos(@x), #0()) -> #GT() , #compare(#pos(@x), #neg(@y)) -> #GT() , #compare(#pos(@x), #pos(@y)) -> #compare(@x, @y) , #compare(#s(@x), #0()) -> #GT() , #compare(#s(@x), #s(@y)) -> #compare(@x, @y) , #cklt(#EQ()) -> #false() , #cklt(#GT()) -> #false() , #cklt(#LT()) -> #true() , append(@l1, @l2) -> append#1(@l1, @l2) , append#1(::(@x, @xs), @l2) -> ::(@x, append(@xs, @l2)) , append#1(nil(), @l2) -> @l2 , flatten(@t) -> flatten#1(@t) , flatten#1(leaf()) -> nil() , flatten#1(node(@l, @t1, @t2)) -> append(@l, append(flatten(@t1), flatten(@t2))) , insertionsort(@l) -> insertionsort#1(@l) , insert(@x, @l) -> insert#1(@l, @x) , insert#1(::(@y, @ys), @x) -> insert#2(#less(@y, @x), @x, @y, @ys) , insert#1(nil(), @x) -> ::(@x, nil()) , insert#2(#false(), @x, @y, @ys) -> ::(@x, ::(@y, @ys)) , insert#2(#true(), @x, @y, @ys) -> ::(@y, insert(@x, @ys)) , insertionsort#1(::(@x, @xs)) -> insert(@x, insertionsort(@xs)) , insertionsort#1(nil()) -> nil() } StartTerms: basic terms Strategy: innermost The following weak DPs constitute a sub-graph of the DG that is closed under successors. The DPs are removed. { append^#(@l1, @l2) -> c_1(append#1^#(@l1, @l2)) , append#1^#(::(@x, @xs), @l2) -> c_2(append^#(@xs, @l2)) , flatten^#(@t) -> c_3(flatten#1^#(@t)) , flatten#1^#(node(@l, @t1, @t2)) -> c_4(append^#(@l, append(flatten(@t1), flatten(@t2))), append^#(flatten(@t1), flatten(@t2)), flatten^#(@t1), flatten^#(@t2)) } We apply the transformation 'simpDPRHS' on the sub-problem: Strict DPs: { insertionsort^#(@l) -> c_6(insertionsort#1^#(@l)) , insertionsort#1^#(::(@x, @xs)) -> c_7(insert^#(@x, insertionsort(@xs)), insertionsort^#(@xs)) , insert^#(@x, @l) -> c_8(insert#1^#(@l, @x)) , insert#1^#(::(@y, @ys), @x) -> c_9(insert#2^#(#less(@y, @x), @x, @y, @ys)) , insert#2^#(#true(), @x, @y, @ys) -> c_10(insert^#(@x, @ys)) } Weak DPs: { flattensort^#(@t) -> c_5(insertionsort^#(flatten(@t)), flatten^#(@t)) } Weak Trs: { #less(@x, @y) -> #cklt(#compare(@x, @y)) , #compare(#0(), #0()) -> #EQ() , #compare(#0(), #neg(@y)) -> #GT() , #compare(#0(), #pos(@y)) -> #LT() , #compare(#0(), #s(@y)) -> #LT() , #compare(#neg(@x), #0()) -> #LT() , #compare(#neg(@x), #neg(@y)) -> #compare(@y, @x) , #compare(#neg(@x), #pos(@y)) -> #LT() , #compare(#pos(@x), #0()) -> #GT() , #compare(#pos(@x), #neg(@y)) -> #GT() , #compare(#pos(@x), #pos(@y)) -> #compare(@x, @y) , #compare(#s(@x), #0()) -> #GT() , #compare(#s(@x), #s(@y)) -> #compare(@x, @y) , #cklt(#EQ()) -> #false() , #cklt(#GT()) -> #false() , #cklt(#LT()) -> #true() , append(@l1, @l2) -> append#1(@l1, @l2) , append#1(::(@x, @xs), @l2) -> ::(@x, append(@xs, @l2)) , append#1(nil(), @l2) -> @l2 , flatten(@t) -> flatten#1(@t) , flatten#1(leaf()) -> nil() , flatten#1(node(@l, @t1, @t2)) -> append(@l, append(flatten(@t1), flatten(@t2))) , insertionsort(@l) -> insertionsort#1(@l) , insert(@x, @l) -> insert#1(@l, @x) , insert#1(::(@y, @ys), @x) -> insert#2(#less(@y, @x), @x, @y, @ys) , insert#1(nil(), @x) -> ::(@x, nil()) , insert#2(#false(), @x, @y, @ys) -> ::(@x, ::(@y, @ys)) , insert#2(#true(), @x, @y, @ys) -> ::(@y, insert(@x, @ys)) , insertionsort#1(::(@x, @xs)) -> insert(@x, insertionsort(@xs)) , insertionsort#1(nil()) -> nil() } StartTerms: basic terms Strategy: innermost Due to missing edges in the dependency-graph, the right-hand sides of following rules could be simplified: { flattensort^#(@t) -> c_5(insertionsort^#(flatten(@t)), flatten^#(@t)) } We are left with following problem, upon which TcT provides the certificate YES(O(1),O(n^2)). Strict DPs: { insertionsort^#(@l) -> c_1(insertionsort#1^#(@l)) , insertionsort#1^#(::(@x, @xs)) -> c_2(insert^#(@x, insertionsort(@xs)), insertionsort^#(@xs)) , insert^#(@x, @l) -> c_3(insert#1^#(@l, @x)) , insert#1^#(::(@y, @ys), @x) -> c_4(insert#2^#(#less(@y, @x), @x, @y, @ys)) , insert#2^#(#true(), @x, @y, @ys) -> c_5(insert^#(@x, @ys)) } Weak DPs: { flattensort^#(@t) -> c_6(insertionsort^#(flatten(@t))) } Weak Trs: { #less(@x, @y) -> #cklt(#compare(@x, @y)) , #compare(#0(), #0()) -> #EQ() , #compare(#0(), #neg(@y)) -> #GT() , #compare(#0(), #pos(@y)) -> #LT() , #compare(#0(), #s(@y)) -> #LT() , #compare(#neg(@x), #0()) -> #LT() , #compare(#neg(@x), #neg(@y)) -> #compare(@y, @x) , #compare(#neg(@x), #pos(@y)) -> #LT() , #compare(#pos(@x), #0()) -> #GT() , #compare(#pos(@x), #neg(@y)) -> #GT() , #compare(#pos(@x), #pos(@y)) -> #compare(@x, @y) , #compare(#s(@x), #0()) -> #GT() , #compare(#s(@x), #s(@y)) -> #compare(@x, @y) , #cklt(#EQ()) -> #false() , #cklt(#GT()) -> #false() , #cklt(#LT()) -> #true() , append(@l1, @l2) -> append#1(@l1, @l2) , append#1(::(@x, @xs), @l2) -> ::(@x, append(@xs, @l2)) , append#1(nil(), @l2) -> @l2 , flatten(@t) -> flatten#1(@t) , flatten#1(leaf()) -> nil() , flatten#1(node(@l, @t1, @t2)) -> append(@l, append(flatten(@t1), flatten(@t2))) , insertionsort(@l) -> insertionsort#1(@l) , insert(@x, @l) -> insert#1(@l, @x) , insert#1(::(@y, @ys), @x) -> insert#2(#less(@y, @x), @x, @y, @ys) , insert#1(nil(), @x) -> ::(@x, nil()) , insert#2(#false(), @x, @y, @ys) -> ::(@x, ::(@y, @ys)) , insert#2(#true(), @x, @y, @ys) -> ::(@y, insert(@x, @ys)) , insertionsort#1(::(@x, @xs)) -> insert(@x, insertionsort(@xs)) , insertionsort#1(nil()) -> nil() } Obligation: innermost runtime complexity Answer: YES(O(1),O(n^2)) We decompose the input problem according to the dependency graph into the upper component { flattensort^#(@t) -> c_6(insertionsort^#(flatten(@t))) , insertionsort^#(@l) -> c_1(insertionsort#1^#(@l)) , insertionsort#1^#(::(@x, @xs)) -> c_2(insert^#(@x, insertionsort(@xs)), insertionsort^#(@xs)) } and lower component { insert^#(@x, @l) -> c_3(insert#1^#(@l, @x)) , insert#1^#(::(@y, @ys), @x) -> c_4(insert#2^#(#less(@y, @x), @x, @y, @ys)) , insert#2^#(#true(), @x, @y, @ys) -> c_5(insert^#(@x, @ys)) } Further, following extension rules are added to the lower component. { flattensort^#(@t) -> insertionsort^#(flatten(@t)) , insertionsort^#(@l) -> insertionsort#1^#(@l) , insertionsort#1^#(::(@x, @xs)) -> insertionsort^#(@xs) , insertionsort#1^#(::(@x, @xs)) -> insert^#(@x, insertionsort(@xs)) } TcT solves the upper component with certificate YES(O(1),O(n^1)). Sub-proof: ---------- We are left with following problem, upon which TcT provides the certificate YES(O(1),O(n^1)). Strict DPs: { insertionsort^#(@l) -> c_1(insertionsort#1^#(@l)) , insertionsort#1^#(::(@x, @xs)) -> c_2(insert^#(@x, insertionsort(@xs)), insertionsort^#(@xs)) } Weak DPs: { flattensort^#(@t) -> c_6(insertionsort^#(flatten(@t))) } Weak Trs: { #less(@x, @y) -> #cklt(#compare(@x, @y)) , #compare(#0(), #0()) -> #EQ() , #compare(#0(), #neg(@y)) -> #GT() , #compare(#0(), #pos(@y)) -> #LT() , #compare(#0(), #s(@y)) -> #LT() , #compare(#neg(@x), #0()) -> #LT() , #compare(#neg(@x), #neg(@y)) -> #compare(@y, @x) , #compare(#neg(@x), #pos(@y)) -> #LT() , #compare(#pos(@x), #0()) -> #GT() , #compare(#pos(@x), #neg(@y)) -> #GT() , #compare(#pos(@x), #pos(@y)) -> #compare(@x, @y) , #compare(#s(@x), #0()) -> #GT() , #compare(#s(@x), #s(@y)) -> #compare(@x, @y) , #cklt(#EQ()) -> #false() , #cklt(#GT()) -> #false() , #cklt(#LT()) -> #true() , append(@l1, @l2) -> append#1(@l1, @l2) , append#1(::(@x, @xs), @l2) -> ::(@x, append(@xs, @l2)) , append#1(nil(), @l2) -> @l2 , flatten(@t) -> flatten#1(@t) , flatten#1(leaf()) -> nil() , flatten#1(node(@l, @t1, @t2)) -> append(@l, append(flatten(@t1), flatten(@t2))) , insertionsort(@l) -> insertionsort#1(@l) , insert(@x, @l) -> insert#1(@l, @x) , insert#1(::(@y, @ys), @x) -> insert#2(#less(@y, @x), @x, @y, @ys) , insert#1(nil(), @x) -> ::(@x, nil()) , insert#2(#false(), @x, @y, @ys) -> ::(@x, ::(@y, @ys)) , insert#2(#true(), @x, @y, @ys) -> ::(@y, insert(@x, @ys)) , insertionsort#1(::(@x, @xs)) -> insert(@x, insertionsort(@xs)) , insertionsort#1(nil()) -> nil() } Obligation: innermost runtime complexity Answer: YES(O(1),O(n^1)) Due to missing edges in the dependency-graph, the right-hand sides of following rules could be simplified: { insertionsort#1^#(::(@x, @xs)) -> c_2(insert^#(@x, insertionsort(@xs)), insertionsort^#(@xs)) } We are left with following problem, upon which TcT provides the certificate YES(O(1),O(n^1)). Strict DPs: { insertionsort^#(@l) -> c_1(insertionsort#1^#(@l)) , insertionsort#1^#(::(@x, @xs)) -> c_2(insertionsort^#(@xs)) } Weak DPs: { flattensort^#(@t) -> c_3(insertionsort^#(flatten(@t))) } Weak Trs: { #less(@x, @y) -> #cklt(#compare(@x, @y)) , #compare(#0(), #0()) -> #EQ() , #compare(#0(), #neg(@y)) -> #GT() , #compare(#0(), #pos(@y)) -> #LT() , #compare(#0(), #s(@y)) -> #LT() , #compare(#neg(@x), #0()) -> #LT() , #compare(#neg(@x), #neg(@y)) -> #compare(@y, @x) , #compare(#neg(@x), #pos(@y)) -> #LT() , #compare(#pos(@x), #0()) -> #GT() , #compare(#pos(@x), #neg(@y)) -> #GT() , #compare(#pos(@x), #pos(@y)) -> #compare(@x, @y) , #compare(#s(@x), #0()) -> #GT() , #compare(#s(@x), #s(@y)) -> #compare(@x, @y) , #cklt(#EQ()) -> #false() , #cklt(#GT()) -> #false() , #cklt(#LT()) -> #true() , append(@l1, @l2) -> append#1(@l1, @l2) , append#1(::(@x, @xs), @l2) -> ::(@x, append(@xs, @l2)) , append#1(nil(), @l2) -> @l2 , flatten(@t) -> flatten#1(@t) , flatten#1(leaf()) -> nil() , flatten#1(node(@l, @t1, @t2)) -> append(@l, append(flatten(@t1), flatten(@t2))) , insertionsort(@l) -> insertionsort#1(@l) , insert(@x, @l) -> insert#1(@l, @x) , insert#1(::(@y, @ys), @x) -> insert#2(#less(@y, @x), @x, @y, @ys) , insert#1(nil(), @x) -> ::(@x, nil()) , insert#2(#false(), @x, @y, @ys) -> ::(@x, ::(@y, @ys)) , insert#2(#true(), @x, @y, @ys) -> ::(@y, insert(@x, @ys)) , insertionsort#1(::(@x, @xs)) -> insert(@x, insertionsort(@xs)) , insertionsort#1(nil()) -> nil() } Obligation: innermost runtime complexity Answer: YES(O(1),O(n^1)) We replace rewrite rules by usable rules: Weak Usable Rules: { append(@l1, @l2) -> append#1(@l1, @l2) , append#1(::(@x, @xs), @l2) -> ::(@x, append(@xs, @l2)) , append#1(nil(), @l2) -> @l2 , flatten(@t) -> flatten#1(@t) , flatten#1(leaf()) -> nil() , flatten#1(node(@l, @t1, @t2)) -> append(@l, append(flatten(@t1), flatten(@t2))) } We are left with following problem, upon which TcT provides the certificate YES(O(1),O(n^1)). Strict DPs: { insertionsort^#(@l) -> c_1(insertionsort#1^#(@l)) , insertionsort#1^#(::(@x, @xs)) -> c_2(insertionsort^#(@xs)) } Weak DPs: { flattensort^#(@t) -> c_3(insertionsort^#(flatten(@t))) } Weak Trs: { append(@l1, @l2) -> append#1(@l1, @l2) , append#1(::(@x, @xs), @l2) -> ::(@x, append(@xs, @l2)) , append#1(nil(), @l2) -> @l2 , flatten(@t) -> flatten#1(@t) , flatten#1(leaf()) -> nil() , flatten#1(node(@l, @t1, @t2)) -> append(@l, append(flatten(@t1), flatten(@t2))) } Obligation: innermost runtime complexity Answer: YES(O(1),O(n^1)) We use the processor 'matrix interpretation of dimension 1' to orient following rules strictly. DPs: { 2: insertionsort#1^#(::(@x, @xs)) -> c_2(insertionsort^#(@xs)) , 3: flattensort^#(@t) -> c_3(insertionsort^#(flatten(@t))) } Trs: { flatten#1(node(@l, @t1, @t2)) -> append(@l, append(flatten(@t1), flatten(@t2))) } Sub-proof: ---------- The following argument positions are usable: Uargs(c_1) = {1}, Uargs(c_2) = {1}, Uargs(c_3) = {1} TcT has computed following constructor-based matrix interpretation satisfying not(EDA). [#less](x1, x2) = [0] [#compare](x1, x2) = [0] [#cklt](x1) = [0] [append](x1, x2) = [1] x1 + [1] x2 + [0] [append#1](x1, x2) = [1] x1 + [1] x2 + [0] [::](x1, x2) = [1] x2 + [1] [nil] = [0] [flatten](x1) = [1] x1 + [0] [flatten#1](x1) = [1] x1 + [0] [leaf] = [0] [node](x1, x2, x3) = [1] x1 + [1] x2 + [1] x3 + [1] [insertionsort](x1) = [0] [insert](x1, x2) = [0] [insert#1](x1, x2) = [0] [insert#2](x1, x2, x3, x4) = [0] [#false] = [0] [#true] = [0] [insertionsort#1](x1) = [0] [#EQ] = [0] [#GT] = [0] [#LT] = [0] [#0] = [0] [#neg](x1) = [0] [#pos](x1) = [0] [#s](x1) = [0] [#less^#](x1, x2) = [0] [#cklt^#](x1) = [0] [#compare^#](x1, x2) = [0] [append^#](x1, x2) = [0] [append#1^#](x1, x2) = [0] [flatten^#](x1) = [0] [flatten#1^#](x1) = [0] [flattensort^#](x1) = [1] x1 + [1] [insertionsort^#](x1) = [1] x1 + [0] [insertionsort#1^#](x1) = [1] x1 + [0] [insert^#](x1, x2) = [0] [insert#1^#](x1, x2) = [0] [insert#2^#](x1, x2, x3, x4) = [0] [c_1](x1) = [0] [c_2](x1, x2) = [0] [c_6](x1) = [0] [c] = [0] [c_1](x1) = [1] x1 + [0] [c_2](x1) = [1] x1 + [0] [c_3](x1) = [1] x1 + [0] This order satisfies following ordering constraints [append(@l1, @l2)] = [1] @l1 + [1] @l2 + [0] >= [1] @l1 + [1] @l2 + [0] = [append#1(@l1, @l2)] [append#1(::(@x, @xs), @l2)] = [1] @l2 + [1] @xs + [1] >= [1] @l2 + [1] @xs + [1] = [::(@x, append(@xs, @l2))] [append#1(nil(), @l2)] = [1] @l2 + [0] >= [1] @l2 + [0] = [@l2] [flatten(@t)] = [1] @t + [0] >= [1] @t + [0] = [flatten#1(@t)] [flatten#1(leaf())] = [0] >= [0] = [nil()] [flatten#1(node(@l, @t1, @t2))] = [1] @l + [1] @t1 + [1] @t2 + [1] > [1] @l + [1] @t1 + [1] @t2 + [0] = [append(@l, append(flatten(@t1), flatten(@t2)))] [flattensort^#(@t)] = [1] @t + [1] > [1] @t + [0] = [c_3(insertionsort^#(flatten(@t)))] [insertionsort^#(@l)] = [1] @l + [0] >= [1] @l + [0] = [c_1(insertionsort#1^#(@l))] [insertionsort#1^#(::(@x, @xs))] = [1] @xs + [1] > [1] @xs + [0] = [c_2(insertionsort^#(@xs))] Consider the set of all dependency pairs DPs: { 1: insertionsort^#(@l) -> c_1(insertionsort#1^#(@l)) , 2: insertionsort#1^#(::(@x, @xs)) -> c_2(insertionsort^#(@xs)) , 3: flattensort^#(@t) -> c_3(insertionsort^#(flatten(@t))) } Processor 'matrix interpretation of dimension 1' induces the complexity certificate YES(?,O(n^1)) on application of dependency pairs {2,3}. These cover all (indirect) predecessors of dependency pairs {1,2,3}, their number of application is equally bounded. The dependency pairs are shifted into the corresponding weak component(s). We apply the transformation 'removetails' on the sub-problem: Weak DPs: { flattensort^#(@t) -> c_3(insertionsort^#(flatten(@t))) , insertionsort^#(@l) -> c_1(insertionsort#1^#(@l)) , insertionsort#1^#(::(@x, @xs)) -> c_2(insertionsort^#(@xs)) } Weak Trs: { append(@l1, @l2) -> append#1(@l1, @l2) , append#1(::(@x, @xs), @l2) -> ::(@x, append(@xs, @l2)) , append#1(nil(), @l2) -> @l2 , flatten(@t) -> flatten#1(@t) , flatten#1(leaf()) -> nil() , flatten#1(node(@l, @t1, @t2)) -> append(@l, append(flatten(@t1), flatten(@t2))) } StartTerms: basic terms Strategy: innermost The following weak DPs constitute a sub-graph of the DG that is closed under successors. The DPs are removed. { flattensort^#(@t) -> c_3(insertionsort^#(flatten(@t))) , insertionsort^#(@l) -> c_1(insertionsort#1^#(@l)) , insertionsort#1^#(::(@x, @xs)) -> c_2(insertionsort^#(@xs)) } We apply the transformation 'usablerules' on the sub-problem: Weak Trs: { append(@l1, @l2) -> append#1(@l1, @l2) , append#1(::(@x, @xs), @l2) -> ::(@x, append(@xs, @l2)) , append#1(nil(), @l2) -> @l2 , flatten(@t) -> flatten#1(@t) , flatten#1(leaf()) -> nil() , flatten#1(node(@l, @t1, @t2)) -> append(@l, append(flatten(@t1), flatten(@t2))) } StartTerms: basic terms Strategy: innermost No rule is usable, rules are removed from the input problem. We are left with following problem, upon which TcT provides the certificate YES(O(1),O(1)). Rules: Empty Obligation: innermost runtime complexity Answer: YES(O(1),O(1)) Empty rules are trivially bounded We return to the main proof. We are left with following problem, upon which TcT provides the certificate YES(O(1),O(n^1)). Strict DPs: { insert^#(@x, @l) -> c_3(insert#1^#(@l, @x)) , insert#1^#(::(@y, @ys), @x) -> c_4(insert#2^#(#less(@y, @x), @x, @y, @ys)) , insert#2^#(#true(), @x, @y, @ys) -> c_5(insert^#(@x, @ys)) } Weak DPs: { flattensort^#(@t) -> insertionsort^#(flatten(@t)) , insertionsort^#(@l) -> insertionsort#1^#(@l) , insertionsort#1^#(::(@x, @xs)) -> insertionsort^#(@xs) , insertionsort#1^#(::(@x, @xs)) -> insert^#(@x, insertionsort(@xs)) } Weak Trs: { #less(@x, @y) -> #cklt(#compare(@x, @y)) , #compare(#0(), #0()) -> #EQ() , #compare(#0(), #neg(@y)) -> #GT() , #compare(#0(), #pos(@y)) -> #LT() , #compare(#0(), #s(@y)) -> #LT() , #compare(#neg(@x), #0()) -> #LT() , #compare(#neg(@x), #neg(@y)) -> #compare(@y, @x) , #compare(#neg(@x), #pos(@y)) -> #LT() , #compare(#pos(@x), #0()) -> #GT() , #compare(#pos(@x), #neg(@y)) -> #GT() , #compare(#pos(@x), #pos(@y)) -> #compare(@x, @y) , #compare(#s(@x), #0()) -> #GT() , #compare(#s(@x), #s(@y)) -> #compare(@x, @y) , #cklt(#EQ()) -> #false() , #cklt(#GT()) -> #false() , #cklt(#LT()) -> #true() , append(@l1, @l2) -> append#1(@l1, @l2) , append#1(::(@x, @xs), @l2) -> ::(@x, append(@xs, @l2)) , append#1(nil(), @l2) -> @l2 , flatten(@t) -> flatten#1(@t) , flatten#1(leaf()) -> nil() , flatten#1(node(@l, @t1, @t2)) -> append(@l, append(flatten(@t1), flatten(@t2))) , insertionsort(@l) -> insertionsort#1(@l) , insert(@x, @l) -> insert#1(@l, @x) , insert#1(::(@y, @ys), @x) -> insert#2(#less(@y, @x), @x, @y, @ys) , insert#1(nil(), @x) -> ::(@x, nil()) , insert#2(#false(), @x, @y, @ys) -> ::(@x, ::(@y, @ys)) , insert#2(#true(), @x, @y, @ys) -> ::(@y, insert(@x, @ys)) , insertionsort#1(::(@x, @xs)) -> insert(@x, insertionsort(@xs)) , insertionsort#1(nil()) -> nil() } Obligation: innermost runtime complexity Answer: YES(O(1),O(n^1)) We use the processor 'matrix interpretation of dimension 1' to orient following rules strictly. DPs: { 2: insert#1^#(::(@y, @ys), @x) -> c_4(insert#2^#(#less(@y, @x), @x, @y, @ys)) , 6: insertionsort#1^#(::(@x, @xs)) -> insertionsort^#(@xs) } Trs: { #compare(#0(), #0()) -> #EQ() , #compare(#0(), #neg(@y)) -> #GT() , #compare(#0(), #pos(@y)) -> #LT() , #compare(#0(), #s(@y)) -> #LT() , #compare(#neg(@x), #0()) -> #LT() , #compare(#neg(@x), #pos(@y)) -> #LT() , #compare(#pos(@x), #0()) -> #GT() , #compare(#pos(@x), #neg(@y)) -> #GT() , #compare(#pos(@x), #pos(@y)) -> #compare(@x, @y) , #compare(#s(@x), #0()) -> #GT() , flatten#1(leaf()) -> nil() , flatten#1(node(@l, @t1, @t2)) -> append(@l, append(flatten(@t1), flatten(@t2))) , insertionsort#1(nil()) -> nil() } Sub-proof: ---------- The following argument positions are usable: Uargs(c_3) = {1}, Uargs(c_4) = {1}, Uargs(c_5) = {1} TcT has computed following constructor-based matrix interpretation satisfying not(EDA). [#less](x1, x2) = [1] [#compare](x1, x2) = [1] x1 + [1] x2 + [1] [#cklt](x1) = [1] [append](x1, x2) = [1] x1 + [1] x2 + [0] [append#1](x1, x2) = [1] x1 + [1] x2 + [0] [::](x1, x2) = [1] x2 + [1] [nil] = [0] [flatten](x1) = [1] x1 + [0] [flatten#1](x1) = [1] x1 + [0] [leaf] = [1] [node](x1, x2, x3) = [1] x1 + [1] x2 + [1] x3 + [1] [insertionsort](x1) = [1] x1 + [1] [insert](x1, x2) = [1] x2 + [1] [insert#1](x1, x2) = [1] x1 + [1] [insert#2](x1, x2, x3, x4) = [1] x1 + [1] x4 + [1] [#false] = [1] [#true] = [1] [insertionsort#1](x1) = [1] x1 + [1] [#EQ] = [0] [#GT] = [0] [#LT] = [0] [#0] = [1] [#neg](x1) = [1] x1 + [0] [#pos](x1) = [1] x1 + [1] [#s](x1) = [1] x1 + [0] [#less^#](x1, x2) = [0] [#cklt^#](x1) = [0] [#compare^#](x1, x2) = [0] [append^#](x1, x2) = [0] [append#1^#](x1, x2) = [0] [flatten^#](x1) = [0] [flatten#1^#](x1) = [0] [flattensort^#](x1) = [1] x1 + [1] [insertionsort^#](x1) = [1] x1 + [1] [insertionsort#1^#](x1) = [1] x1 + [1] [insert^#](x1, x2) = [1] x2 + [1] [insert#1^#](x1, x2) = [1] x1 + [1] [insert#2^#](x1, x2, x3, x4) = [1] x4 + [1] [c_3](x1) = [1] x1 + [0] [c_4](x1) = [1] x1 + [0] [c_5](x1) = [1] x1 + [0] This order satisfies following ordering constraints [#less(@x, @y)] = [1] >= [1] = [#cklt(#compare(@x, @y))] [#cklt(#EQ())] = [1] >= [1] = [#false()] [#cklt(#GT())] = [1] >= [1] = [#false()] [#cklt(#LT())] = [1] >= [1] = [#true()] [append(@l1, @l2)] = [1] @l1 + [1] @l2 + [0] >= [1] @l1 + [1] @l2 + [0] = [append#1(@l1, @l2)] [append#1(::(@x, @xs), @l2)] = [1] @l2 + [1] @xs + [1] >= [1] @l2 + [1] @xs + [1] = [::(@x, append(@xs, @l2))] [append#1(nil(), @l2)] = [1] @l2 + [0] >= [1] @l2 + [0] = [@l2] [flatten(@t)] = [1] @t + [0] >= [1] @t + [0] = [flatten#1(@t)] [flatten#1(leaf())] = [1] > [0] = [nil()] [flatten#1(node(@l, @t1, @t2))] = [1] @l + [1] @t1 + [1] @t2 + [1] > [1] @l + [1] @t1 + [1] @t2 + [0] = [append(@l, append(flatten(@t1), flatten(@t2)))] [insertionsort(@l)] = [1] @l + [1] >= [1] @l + [1] = [insertionsort#1(@l)] [insert(@x, @l)] = [1] @l + [1] >= [1] @l + [1] = [insert#1(@l, @x)] [insert#1(::(@y, @ys), @x)] = [1] @ys + [2] >= [1] @ys + [2] = [insert#2(#less(@y, @x), @x, @y, @ys)] [insert#1(nil(), @x)] = [1] >= [1] = [::(@x, nil())] [insert#2(#false(), @x, @y, @ys)] = [1] @ys + [2] >= [1] @ys + [2] = [::(@x, ::(@y, @ys))] [insert#2(#true(), @x, @y, @ys)] = [1] @ys + [2] >= [1] @ys + [2] = [::(@y, insert(@x, @ys))] [insertionsort#1(::(@x, @xs))] = [1] @xs + [2] >= [1] @xs + [2] = [insert(@x, insertionsort(@xs))] [insertionsort#1(nil())] = [1] > [0] = [nil()] [flattensort^#(@t)] = [1] @t + [1] >= [1] @t + [1] = [insertionsort^#(flatten(@t))] [insertionsort^#(@l)] = [1] @l + [1] >= [1] @l + [1] = [insertionsort#1^#(@l)] [insertionsort#1^#(::(@x, @xs))] = [1] @xs + [2] > [1] @xs + [1] = [insertionsort^#(@xs)] [insertionsort#1^#(::(@x, @xs))] = [1] @xs + [2] >= [1] @xs + [2] = [insert^#(@x, insertionsort(@xs))] [insert^#(@x, @l)] = [1] @l + [1] >= [1] @l + [1] = [c_3(insert#1^#(@l, @x))] [insert#1^#(::(@y, @ys), @x)] = [1] @ys + [2] > [1] @ys + [1] = [c_4(insert#2^#(#less(@y, @x), @x, @y, @ys))] [insert#2^#(#true(), @x, @y, @ys)] = [1] @ys + [1] >= [1] @ys + [1] = [c_5(insert^#(@x, @ys))] Consider the set of all dependency pairs DPs: { 1: insert^#(@x, @l) -> c_3(insert#1^#(@l, @x)) , 2: insert#1^#(::(@y, @ys), @x) -> c_4(insert#2^#(#less(@y, @x), @x, @y, @ys)) , 3: insert#2^#(#true(), @x, @y, @ys) -> c_5(insert^#(@x, @ys)) , 4: flattensort^#(@t) -> insertionsort^#(flatten(@t)) , 5: insertionsort^#(@l) -> insertionsort#1^#(@l) , 6: insertionsort#1^#(::(@x, @xs)) -> insertionsort^#(@xs) , 7: insertionsort#1^#(::(@x, @xs)) -> insert^#(@x, insertionsort(@xs)) } Processor 'matrix interpretation of dimension 1' induces the complexity certificate YES(?,O(n^1)) on application of dependency pairs {2,6}. These cover all (indirect) predecessors of dependency pairs {1,2,3,4,5,6,7}, their number of application is equally bounded. The dependency pairs are shifted into the corresponding weak component(s). We apply the transformation 'removetails' on the sub-problem: Weak DPs: { flattensort^#(@t) -> insertionsort^#(flatten(@t)) , insertionsort^#(@l) -> insertionsort#1^#(@l) , insertionsort#1^#(::(@x, @xs)) -> insertionsort^#(@xs) , insertionsort#1^#(::(@x, @xs)) -> insert^#(@x, insertionsort(@xs)) , insert^#(@x, @l) -> c_3(insert#1^#(@l, @x)) , insert#1^#(::(@y, @ys), @x) -> c_4(insert#2^#(#less(@y, @x), @x, @y, @ys)) , insert#2^#(#true(), @x, @y, @ys) -> c_5(insert^#(@x, @ys)) } Weak Trs: { #less(@x, @y) -> #cklt(#compare(@x, @y)) , #compare(#0(), #0()) -> #EQ() , #compare(#0(), #neg(@y)) -> #GT() , #compare(#0(), #pos(@y)) -> #LT() , #compare(#0(), #s(@y)) -> #LT() , #compare(#neg(@x), #0()) -> #LT() , #compare(#neg(@x), #neg(@y)) -> #compare(@y, @x) , #compare(#neg(@x), #pos(@y)) -> #LT() , #compare(#pos(@x), #0()) -> #GT() , #compare(#pos(@x), #neg(@y)) -> #GT() , #compare(#pos(@x), #pos(@y)) -> #compare(@x, @y) , #compare(#s(@x), #0()) -> #GT() , #compare(#s(@x), #s(@y)) -> #compare(@x, @y) , #cklt(#EQ()) -> #false() , #cklt(#GT()) -> #false() , #cklt(#LT()) -> #true() , append(@l1, @l2) -> append#1(@l1, @l2) , append#1(::(@x, @xs), @l2) -> ::(@x, append(@xs, @l2)) , append#1(nil(), @l2) -> @l2 , flatten(@t) -> flatten#1(@t) , flatten#1(leaf()) -> nil() , flatten#1(node(@l, @t1, @t2)) -> append(@l, append(flatten(@t1), flatten(@t2))) , insertionsort(@l) -> insertionsort#1(@l) , insert(@x, @l) -> insert#1(@l, @x) , insert#1(::(@y, @ys), @x) -> insert#2(#less(@y, @x), @x, @y, @ys) , insert#1(nil(), @x) -> ::(@x, nil()) , insert#2(#false(), @x, @y, @ys) -> ::(@x, ::(@y, @ys)) , insert#2(#true(), @x, @y, @ys) -> ::(@y, insert(@x, @ys)) , insertionsort#1(::(@x, @xs)) -> insert(@x, insertionsort(@xs)) , insertionsort#1(nil()) -> nil() } StartTerms: basic terms Strategy: innermost The following weak DPs constitute a sub-graph of the DG that is closed under successors. The DPs are removed. { flattensort^#(@t) -> insertionsort^#(flatten(@t)) , insertionsort^#(@l) -> insertionsort#1^#(@l) , insertionsort#1^#(::(@x, @xs)) -> insertionsort^#(@xs) , insertionsort#1^#(::(@x, @xs)) -> insert^#(@x, insertionsort(@xs)) , insert^#(@x, @l) -> c_3(insert#1^#(@l, @x)) , insert#1^#(::(@y, @ys), @x) -> c_4(insert#2^#(#less(@y, @x), @x, @y, @ys)) , insert#2^#(#true(), @x, @y, @ys) -> c_5(insert^#(@x, @ys)) } We apply the transformation 'usablerules' on the sub-problem: Weak Trs: { #less(@x, @y) -> #cklt(#compare(@x, @y)) , #compare(#0(), #0()) -> #EQ() , #compare(#0(), #neg(@y)) -> #GT() , #compare(#0(), #pos(@y)) -> #LT() , #compare(#0(), #s(@y)) -> #LT() , #compare(#neg(@x), #0()) -> #LT() , #compare(#neg(@x), #neg(@y)) -> #compare(@y, @x) , #compare(#neg(@x), #pos(@y)) -> #LT() , #compare(#pos(@x), #0()) -> #GT() , #compare(#pos(@x), #neg(@y)) -> #GT() , #compare(#pos(@x), #pos(@y)) -> #compare(@x, @y) , #compare(#s(@x), #0()) -> #GT() , #compare(#s(@x), #s(@y)) -> #compare(@x, @y) , #cklt(#EQ()) -> #false() , #cklt(#GT()) -> #false() , #cklt(#LT()) -> #true() , append(@l1, @l2) -> append#1(@l1, @l2) , append#1(::(@x, @xs), @l2) -> ::(@x, append(@xs, @l2)) , append#1(nil(), @l2) -> @l2 , flatten(@t) -> flatten#1(@t) , flatten#1(leaf()) -> nil() , flatten#1(node(@l, @t1, @t2)) -> append(@l, append(flatten(@t1), flatten(@t2))) , insertionsort(@l) -> insertionsort#1(@l) , insert(@x, @l) -> insert#1(@l, @x) , insert#1(::(@y, @ys), @x) -> insert#2(#less(@y, @x), @x, @y, @ys) , insert#1(nil(), @x) -> ::(@x, nil()) , insert#2(#false(), @x, @y, @ys) -> ::(@x, ::(@y, @ys)) , insert#2(#true(), @x, @y, @ys) -> ::(@y, insert(@x, @ys)) , insertionsort#1(::(@x, @xs)) -> insert(@x, insertionsort(@xs)) , insertionsort#1(nil()) -> nil() } StartTerms: basic terms Strategy: innermost No rule is usable, rules are removed from the input problem. We are left with following problem, upon which TcT provides the certificate YES(O(1),O(1)). Rules: Empty Obligation: innermost runtime complexity Answer: YES(O(1),O(1)) Empty rules are trivially bounded Wall-time: 0.155844s CPU-time: 1.151s Wall-time: 25.701767s CPU-time: 155.367s Hurray, we answered YES(O(1),O(n^2))